-
-
Notifications
You must be signed in to change notification settings - Fork 392
Improve Audio Data Processing and Spectrum Analyzer #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Audio Data Processing and Spectrum Analyzer #745
Conversation
89fbe8e
to
9f411fe
Compare
* You might want to slightly damp (blur) the input if your signal isn't | ||
* of a very high quality, to reduce high-frequency noise that would | ||
* otherwise show up in the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any audio we expect people to feed in that will not be of "a very high quality"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know, probably not relevant anymore today. Most of the Doxygen text in this class is just a 1:1 copy of the comments in Milkdrop's code, I didn't change it for "historical reasons". 😁
@@ -0,0 +1,55 @@ | |||
/** | |||
* @file WaveformAligner.hpp | |||
* @brief Mip-based waveform alignment algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc is duplicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... Will just keep the class doc, and only add a "brief" description for the file.
/** | ||
* @brief Calculates equalization factors for each frequency domain. | ||
* | ||
* @param equalize If false, all factors will be set to 1, otherwise will calculate a frequency-based multiplier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of the equalizer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet
Removed the previous FFT algorithm, now using a modernized version of the original Milkdrop FFT transform which also has both an equalizer and frequency envelope, making it slightly more sophisticated. Modernization mainly included replacing raw pointer arrays with std::vector and using STL types/functions for the calculation, specifically std::complex as the FFT heavily uses these numbers. This makes the code more compact and readable. Manually tested both original and modernized versions of the class to test if the algorithm still returns the exact same results, which is the case.
Consolidated audio processing code into the PCM class, removing the BeatDetect class in the process. Beat detection now uses the same algorithm as Milkdrop, passing the proper relative bass/mid/treb values to presets. Makes many presets look less jumpy/flickering, as the values are now (smoothly) alternating around 1.0. Updating frame audio is now done in a function that must specifically be called. Any subsequent calls to GetFrameAudioData() will then return the exact same copy of the audio data. As of now with the exception that new waveform data may be passed in via a separate thread, which will then be returned and might not match the spectrum data. Will fix that in a later commit.
Also consolidated the waveform sample count constant to keep it aligned over all classes.
The "+1" somehow disappeared at some point...
Directly passing references to the affected members is easier to read in the main UpdateFrameAudioData() method.
dd4053b
to
9c68339
Compare
Reimplemented audio data processing to closely match Milkdrop's algorithms and resulting sample/spectrum values.
proejctM's previous implementation was very simplistic, and thus resulted in sample/beat detection values which weren't even close to what Milkdrop passes to presets. This PR changes/fixes the following audio-related issues:
FFT
class. It also smoothes and equalized the spectrum a bit to remove noise. Now spectrum-based custom waveforms draw properly.Fixes issue #708.